import type { RequestState } from '@self.id/framework' import { Box, Button, Form, FormField, Heading, Paragraph, Text, TextArea } from 'grommet' import type { GetServerSideProps } from 'next' import NotesList from '../../components/NotesList' import { useNote } from '../../hooks' type Props = { did: string id: string state: RequestState } export const getServerSideProps: GetServerSideProps = async ( ctx ) => { const did = ctx.params?.did if (did == null) { return { redirect: { destination: '/', permanent: true }, } } const id = ctx.params?.id if (id == null) { return { redirect: { destination: `/${did}`, permanent: false }, } } const { getRequestState } = await import('../../server') return { props: { did, id, state: await getRequestState(ctx, did) }, } } export default function NotePage({ did, id }: Props) { const note = useNote(did, id) let contents = null if (note.content != null) { const titleButton = note.isEditing ? (